<template>
    <div>
		<table class="table" cellspacing="0" cellpadding="0">
			<tbody>
				<tr>
					<th>订单号</th>
					<th>课程名称</th>
					<th>买家</th>
					<th>卖家</th>
					<th>订单金额</th>
					<th>支付方式</th>
					<th>状态</th>
					<th>支付时间</th>
					<th>订单时间</th>
				</tr>
			</tbody>
			<tbody>
				<tr v-for="(item,index) in listData" :key="index">
					<td>{{item.order_id}}</td>
					<td>{{item.ke_title}}</td>					
					<td>{{item.user_nickname}}</td>
					<td>{{item.sell_user_nickname}}</td>
					<td>{{item.price}}</td>
					<td>
						<WechatOutlined v-if="item.pay_type=='wxpay'" type="wechat" style="color: #66CC00;font-size: 20px;" />
						
						<AlipayCircleOutlined v-else-if="item.pay_type=='alipay'" type="alipay-circle" style="color: #00aaf0;font-size: 20px;" />
						<a-tag v-else-if="item.pay_type=='' || !item.pay_type" color="#87d068">免费</a-tag>
						<span v-else class="d-red">未知</span>
					</td>
					<td>{{item.pay_status}}</td>
					<td>{{item.pay_time}}</td>					
					<td>{{item.create_time}}</td>
				</tr>
			</tbody>
		</table>
		
		<!-- 分页 -->
		<div class="padding-t-20">
			<a-pagination :pageSize="pageSize" :current="page" :total="count"
				@change="clickPage" :pageSizeOptions="pageSizeOptions" show-size-changer
				@showSizeChange="onShowSizeChange" show-quick-jumper />
		</div>
    </div>
</template>

<script>
	import keApi from '../../api/kecheng.js'
	
    export default {
        data() {
        	return {				
				pageSizeOptions: ['20', '50', '100', '150'],
				page: 1,
				pageSize: 20,
				count: '',
				
				listData:''
            }
        },
		mounted() {
			this.getList()
		},
		methods:{
			getList(){
				keApi.getOrderList(this.page, this.pageSize).then(res => {
					if(res.status == 1){
						this.page = res.result.page
						this.pageSize = res.result.pageSize
						this.count = res.result.count
						this.listData = res.result.data
					}
				})
			},
			// 分页
			clickPage(e) {
				this.page = e
				this.getList()
			},
			onShowSizeChange(current, pageSize) {
				this.pageSize = pageSize
				this.page = 1
			}
		}
    }
</script>

<style>
</style>